package com.wss.merchant.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wss.merchant.domain.CommonResult;
import com.wss.merchant.domain.DlNewShopOrderSecond;
import com.wss.merchant.service.DlNewShopOrderSecondService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * <p>
 * 商家订单表 前端控制器
 * </p>
 *
 * @author wss
 * @since 2021-03-18
 */
@Controller
@RequestMapping("/storeOrder")
public class DlNewShopOrderSecondController {
    @Autowired
    private DlNewShopOrderSecondService dlNewShopOrderSecondService;
    @RequestMapping("/getStoreOrder")
    @ResponseBody
    public CommonResult getStoreOrder(@RequestBody Map<String,String> map){
        Page<Map> page = new Page<>(Integer.parseInt(map.get("current")),Integer.parseInt(map.get("size")));
        Page<Map> storeOrder = dlNewShopOrderSecondService.getStoreOrder(page, map);
        return new CommonResult(200,"订单查询",storeOrder);
    }
    @RequestMapping("/orderSend")
    @ResponseBody
    public CommonResult orderSend(@RequestBody Map<String,String> map){
        String order_sn = map.get("order_sn");
        QueryWrapper<DlNewShopOrderSecond> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_sn",order_sn);
        DlNewShopOrderSecond one = dlNewShopOrderSecondService.getOne(queryWrapper);
        one.setStatus(2);
        dlNewShopOrderSecondService.updateById(one);
        return new CommonResult(200,"更新成功");
    }
}

